package com.bw.liveplay.common.mvvm.viewmodel

import android.content.Intent
import android.os.Bundle
import android.widget.ImageView
import android.widget.TextView
import com.bw.liveplay.App
import com.bw.liveplay.common.entity.AddCommentEntity
import com.bw.liveplay.common.entity.BaseEntity
import com.bw.liveplay.common.entity.CommentEntity
import com.bw.liveplay.common.mvvm.adapter.CommentAdapter
import com.bw.liveplay.common.mvvm.mondel.CommentListModel
import com.bw.liveplay.common.mvvm.mondel.HomeListModel
import com.bw.liveplay.common.mvvm.view.AddCommentActivity
import com.bw.liveplay.common.mvvm.view.CommentActivity
import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer
import com.youth.banner.util.LogUtils
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
/**
 * @author KK
 * @description:
 * @date :2021/11/13 8:30
 *
 */
class CommentViewModel : BaseViewModel<CommentListModel>() {

    public var adapter : CommentAdapter= CommentAdapter()
    override fun result(t: BaseEntity) {



        if(t is CommentEntity){
            var commentEntity = t as CommentEntity

            showMsg("aaaaaaaaaaaaa")
            adapter!!.setNewInstance(commentEntity!!.data!!.data)
        }
    }

    override fun initData() {
        m.requestCommentList(0,1615197740457,10,0)
            .observeOn(AndroidSchedulers.mainThread())
            .subscribeOn(Schedulers.io())
            .subscribe(this)

    }

    //添加评论
    fun addcommentClick(){
        var bundle: Bundle = Bundle()
        startPage(AddCommentActivity::class.java,bundle)
    }

}